A parallel or serial matrix of real values. More...
#include <matrix.hpp>
Public Types | |
typedef BaseMatrixInterface< T, I >::TheType | TheType |
typedef BaseMatrixInterface< T, I >::IdxType | IdxType |
Public Member Functions | |
MatrixT (const parallel::Communicator &dist, const int &local_rows, const int &local_cols, const MatrixStorageType &storage_type=Sparse) | |
Constructor. | |
MatrixT (const parallel::Communicator &dist, const int &local_rows, const int &local_cols, const int &max_nz_per_row) | |
Sparse matrix constructor with maximum number of nonzeros in a row. | |
MatrixT (const parallel::Communicator &dist, const int &local_rows, const int &local_cols, const int *nz_by_row) | |
Sparse matrix constructor with number of nonzeros for each row. | |
MatrixT (MatrixImplementation< T, I > *impl) | |
Construct with an existing (allocated) implementation. | |
~MatrixT (void) | |
Destructor. | |
MatrixStorageType | storageType (void) const |
Get the storage type of this matrix. | |
MatrixT * | clone (void) const |
MatrixT * | localClone (void) const |
void | equate (const MatrixT &A) |
Get a part of the matrix (new instance allocated). | |
void | multiplyDiagonal (const VectorT< T, I > &x) |
Multiply this matrix diagonal by the specified vector. | |
void | addDiagonalVector (const VectorT< T, I > &x) |
Add the specified vector to the diagonal of this matrix. | |
void | add (const MatrixT &A) |
Add another matrix to this one, in place. | |
Static Public Member Functions | |
static MatrixT * | createDense (const parallel::Communicator &comm, const int &global_rows, const int &global_cols, const int &local_rows, const int &local_cols) |
Create a Dense Matrix instance with more/less specific ownership. |
A parallel or serial matrix of real values.
This class uses the Pimpl idiom for implementation in order so the interface is completely free of the underlying library. If constructed with a parallel environment with only one process, a serial storage scheme is created, otherwise it's parallel.
typedef BaseMatrixInterface<T, I>::IdxType gridpack::math::MatrixT< T, I >::IdxType |
The size/index type used.
Reimplemented from gridpack::math::BaseMatrixInterface< T, I >.
typedef BaseMatrixInterface<T, I>::TheType gridpack::math::MatrixT< T, I >::TheType |
The numeric type used.
Reimplemented from gridpack::math::BaseMatrixInterface< T, I >.
gridpack::math::MatrixT< T, I >::MatrixT | ( | const parallel::Communicator & | dist, | |
const int & | local_rows, | |||
const int & | local_cols, | |||
const MatrixStorageType & | storage_type = Sparse | |||
) |
Constructor.
A Matrix must be instantiated simulutaneously on all processes involved in the specified communicator. Each process in the communicator will own the number of rows requested.
dist | parallel environment | |
local_rows | matrix rows to be owned by the local process | |
local_cols | matrix columns to be owned by the local process | |
storage_type | specify dense or sparse storage |
gridpack::math::MatrixT< T, I >::MatrixT | ( | const parallel::Communicator & | dist, | |
const int & | local_rows, | |||
const int & | local_cols, | |||
const int & | max_nz_per_row | |||
) |
Sparse matrix constructor with maximum number of nonzeros in a row.
If the underlying math implementation supports it, this constructs a sparse matrix and pre-allocates it to allow max_nz_per_row
nonzeros in each row. If the underlying math library supports it, max_nz_per_row
does not need to be the same on all processors.
dist | parallel environment | |
local_rows | matrix rows to be owned by the local process | |
local_cols | matrix columns to be owned by the local process | |
max_nz_per_row | maximum number of nonzeros in a row |
gridpack::math::MatrixT< T, I >::MatrixT | ( | const parallel::Communicator & | dist, | |
const int & | local_rows, | |||
const int & | local_cols, | |||
const int * | nz_by_row | |||
) |
Sparse matrix constructor with number of nonzeros for each row.
dist | parallel environment | |
local_rows | matrix rows to be owned by the local process | |
local_cols | matrix columns to be owned by the local process | |
nz_by_row |
gridpack::math::MatrixT< T, I >::MatrixT | ( | MatrixImplementation< T, I > * | impl | ) |
Construct with an existing (allocated) implementation.
For internal use only.
impl |
References gridpack::parallel::WrappedDistributed::WrappedDistributed().
gridpack::math::MatrixT< T, I >::~MatrixT | ( | void | ) |
Destructor.
A matrix must be destroyed simulutaneously on all processes involved in the communicator used to instantiate it.
void gridpack::math::MatrixT< T, I >::add | ( | const MatrixT< T, I > & | A | ) |
Add another matrix to this one, in place.
Collective.
The specified matrix A
must be the same global size (rows and columns) as this instance, but local ownership is not important, nor are any differences in nonzero entry patterns.
A | matrix to add to this instance |
void gridpack::math::MatrixT< T, I >::addDiagonalVector | ( | const VectorT< T, I > & | x | ) |
Add the specified vector to the diagonal of this matrix.
Collective
.
x |
MatrixT* gridpack::math::MatrixT< T, I >::clone | ( | void | ) | const |
Make an exact replica of this instance Collective.
References gridpack::math::MatrixT< T, I >::MatrixT().
static MatrixT* gridpack::math::MatrixT< T, I >::createDense | ( | const parallel::Communicator & | comm, | |
const int & | global_rows, | |||
const int & | global_cols, | |||
const int & | local_rows, | |||
const int & | local_cols | |||
) | [static] |
Create a Dense Matrix instance with more/less specific ownership.
comm | ||
stype | ||
global_rows | ||
global_cols | ||
local_rows | ||
local_cols |
void gridpack::math::MatrixT< T, I >::equate | ( | const MatrixT< T, I > & | A | ) |
Get a part of the matrix (new instance allocated).
Make this Matrix equal to another Collective.
A |
MatrixT* gridpack::math::MatrixT< T, I >::localClone | ( | void | ) | const |
References gridpack::math::MatrixT< T, I >::MatrixT().
void gridpack::math::MatrixT< T, I >::multiplyDiagonal | ( | const VectorT< T, I > & | x | ) |
Multiply this matrix diagonal by the specified vector.
Collective.
This is element by element multiplication
x | factor by which all diagonal elements in the matrix are multiplied |
MatrixStorageType gridpack::math::MatrixT< T, I >::storageType | ( | void | ) | const |
Get the storage type of this matrix.